<% layout('/layouts/default.html', {title: '部门领导审批', libs: ['validate']}){ %>
<div class="main-content">
    <div class="box box-main">
        <#form:form id="inputForm" model="${testLeave}" action="${ctx}/test/leave/complete" method="post" class="form-horizontal">
        <div class="box-body">
            <#form:hidden path="tid"/>
            <#form:hidden path="taskId"/>
            <input type="hidden" name="p_B_examineApproved" id="examineResult" />
            <input type="hidden" name="p_COM_comment" id="examineRemark" />
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> ${text('审批意见')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:select name="examineApproved" id="examineApproved" dictType="flow_approval_opinion" blankOption="false" class="form-control isQuick"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required hide">*</span> ${text('批注信息')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="comment" rows="4" maxlength="500" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
                    <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
                </div>
            </div>
        </div>
    </#form:form>
</div>
</div>
<% } %>
<script>
    $("#inputForm").validate({
        submitHandler: function(form){
            $("#examineResult").val($("#examineApproved").val());
            if ($("#comment").val()) {
                $("#examineRemark").val($("#comment").val());
            }
            js.ajaxSubmitForm($(form), function(data){
                js.showMessage(data.message);
                if(data.result == Global.TRUE){
                    js.closeCurrentTabPage(function(contentWindow){
                        contentWindow.page();
                    });
                }
            }, "json");
        }
    });
</script>